// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Message describing ClientConnectorService object.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClientConnectorService {
    /// Required. Name of resource. The name is ignored during creation.
    pub name: std::string::String,

    /// Output only. [Output only] Create time stamp.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User-provided name.
    /// The display name should follow certain format.
    ///
    /// * Must be 6 to 30 characters in length.
    /// * Can only contain lowercase letters, numbers, and hyphens.
    /// * Must start with a letter.
    pub display_name: std::string::String,

    /// Required. The details of the ingress settings.
    pub ingress: std::option::Option<crate::model::client_connector_service::Ingress>,

    /// Required. The details of the egress settings.
    pub egress: std::option::Option<crate::model::client_connector_service::Egress>,

    /// Output only. The operational state of the ClientConnectorService.
    pub state: crate::model::client_connector_service::State,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ClientConnectorService {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ClientConnectorService::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ClientConnectorService::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ClientConnectorService::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ClientConnectorService::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ClientConnectorService::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [display_name][crate::model::ClientConnectorService::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [ingress][crate::model::ClientConnectorService::ingress].
    pub fn set_ingress<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::client_connector_service::Ingress>,
    {
        self.ingress = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ingress][crate::model::ClientConnectorService::ingress].
    pub fn set_or_clear_ingress<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::client_connector_service::Ingress>,
    {
        self.ingress = v.map(|x| x.into());
        self
    }

    /// Sets the value of [egress][crate::model::ClientConnectorService::egress].
    pub fn set_egress<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::client_connector_service::Egress>,
    {
        self.egress = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [egress][crate::model::ClientConnectorService::egress].
    pub fn set_or_clear_egress<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::client_connector_service::Egress>,
    {
        self.egress = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::ClientConnectorService::state].
    pub fn set_state<T: std::convert::Into<crate::model::client_connector_service::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }
}

impl wkt::message::Message for ClientConnectorService {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService"
    }
}

/// Defines additional types related to [ClientConnectorService].
pub mod client_connector_service {
    #[allow(unused_imports)]
    use super::*;

    /// Settings of how to connect to the ClientGateway.
    /// One of the following options should be set.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Ingress {
        pub ingress_config:
            std::option::Option<crate::model::client_connector_service::ingress::IngressConfig>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Ingress {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [ingress_config][crate::model::client_connector_service::Ingress::ingress_config].
        ///
        /// Note that all the setters affecting `ingress_config` are mutually
        /// exclusive.
        pub fn set_ingress_config<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::client_connector_service::ingress::IngressConfig,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.ingress_config = v.into();
            self
        }

        /// The value of [ingress_config][crate::model::client_connector_service::Ingress::ingress_config]
        /// if it holds a `Config`, `None` if the field is not set or
        /// holds a different branch.
        pub fn config(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<crate::model::client_connector_service::ingress::Config>,
        > {
            #[allow(unreachable_patterns)]
            self.ingress_config.as_ref().and_then(|v| match v {
                crate::model::client_connector_service::ingress::IngressConfig::Config(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [ingress_config][crate::model::client_connector_service::Ingress::ingress_config]
        /// to hold a `Config`.
        ///
        /// Note that all the setters affecting `ingress_config` are
        /// mutually exclusive.
        pub fn set_config<
            T: std::convert::Into<
                    std::boxed::Box<crate::model::client_connector_service::ingress::Config>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.ingress_config = std::option::Option::Some(
                crate::model::client_connector_service::ingress::IngressConfig::Config(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for Ingress {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Ingress"
        }
    }

    /// Defines additional types related to [Ingress].
    pub mod ingress {
        #[allow(unused_imports)]
        use super::*;

        /// The basic ingress config for ClientGateways.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Config {
            /// Required. Immutable. The transport protocol used between the client and
            /// the server.
            pub transport_protocol:
                crate::model::client_connector_service::ingress::config::TransportProtocol,

            /// Required. The settings used to configure basic ClientGateways.
            pub destination_routes: std::vec::Vec<
                crate::model::client_connector_service::ingress::config::DestinationRoute,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Config {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [transport_protocol][crate::model::client_connector_service::ingress::Config::transport_protocol].
            pub fn set_transport_protocol<
                T: std::convert::Into<
                        crate::model::client_connector_service::ingress::config::TransportProtocol,
                    >,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.transport_protocol = v.into();
                self
            }

            /// Sets the value of [destination_routes][crate::model::client_connector_service::ingress::Config::destination_routes].
            pub fn set_destination_routes<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<
                        crate::model::client_connector_service::ingress::config::DestinationRoute,
                    >,
            {
                use std::iter::Iterator;
                self.destination_routes = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for Config {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Ingress.Config"
            }
        }

        /// Defines additional types related to [Config].
        pub mod config {
            #[allow(unused_imports)]
            use super::*;

            /// The setting used to configure ClientGateways.
            /// It is adding routes to the client's routing table
            /// after the connection is established.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct DestinationRoute {
                /// Required. The network address of the subnet
                /// for which the packet is routed to the ClientGateway.
                pub address: std::string::String,

                /// Required. The network mask of the subnet
                /// for which the packet is routed to the ClientGateway.
                pub netmask: std::string::String,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl DestinationRoute {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [address][crate::model::client_connector_service::ingress::config::DestinationRoute::address].
                pub fn set_address<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.address = v.into();
                    self
                }

                /// Sets the value of [netmask][crate::model::client_connector_service::ingress::config::DestinationRoute::netmask].
                pub fn set_netmask<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.netmask = v.into();
                    self
                }
            }

            impl wkt::message::Message for DestinationRoute {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Ingress.Config.DestinationRoute"
                }
            }

            /// The protocol used to connect to the server.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum TransportProtocol {
                /// Default value. This value is unused.
                Unspecified,
                /// TCP protocol.
                Tcp,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [TransportProtocol::value] or
                /// [TransportProtocol::name].
                UnknownValue(transport_protocol::UnknownValue),
            }

            #[doc(hidden)]
            pub mod transport_protocol {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl TransportProtocol {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::Tcp => std::option::Option::Some(1),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => {
                            std::option::Option::Some("TRANSPORT_PROTOCOL_UNSPECIFIED")
                        }
                        Self::Tcp => std::option::Option::Some("TCP"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for TransportProtocol {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for TransportProtocol {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for TransportProtocol {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::Tcp,
                        _ => Self::UnknownValue(transport_protocol::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for TransportProtocol {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "TRANSPORT_PROTOCOL_UNSPECIFIED" => Self::Unspecified,
                        "TCP" => Self::Tcp,
                        _ => Self::UnknownValue(transport_protocol::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for TransportProtocol {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::Tcp => serializer.serialize_i32(1),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for TransportProtocol {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransportProtocol>::new(
                        ".google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Ingress.Config.TransportProtocol"))
                }
            }
        }

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum IngressConfig {
            /// The basic ingress config for ClientGateways.
            Config(std::boxed::Box<crate::model::client_connector_service::ingress::Config>),
        }
    }

    /// The details of the egress info. One of the following options should be set.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Egress {
        pub destination_type:
            std::option::Option<crate::model::client_connector_service::egress::DestinationType>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Egress {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destination_type][crate::model::client_connector_service::Egress::destination_type].
        ///
        /// Note that all the setters affecting `destination_type` are mutually
        /// exclusive.
        pub fn set_destination_type<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::client_connector_service::egress::DestinationType,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.destination_type = v.into();
            self
        }

        /// The value of [destination_type][crate::model::client_connector_service::Egress::destination_type]
        /// if it holds a `PeeredVpc`, `None` if the field is not set or
        /// holds a different branch.
        pub fn peered_vpc(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<crate::model::client_connector_service::egress::PeeredVpc>,
        > {
            #[allow(unreachable_patterns)]
            self.destination_type.as_ref().and_then(|v| match v {
                crate::model::client_connector_service::egress::DestinationType::PeeredVpc(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [destination_type][crate::model::client_connector_service::Egress::destination_type]
        /// to hold a `PeeredVpc`.
        ///
        /// Note that all the setters affecting `destination_type` are
        /// mutually exclusive.
        pub fn set_peered_vpc<
            T: std::convert::Into<
                    std::boxed::Box<crate::model::client_connector_service::egress::PeeredVpc>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.destination_type = std::option::Option::Some(
                crate::model::client_connector_service::egress::DestinationType::PeeredVpc(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for Egress {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Egress"
        }
    }

    /// Defines additional types related to [Egress].
    pub mod egress {
        #[allow(unused_imports)]
        use super::*;

        /// The peered VPC owned by the consumer project.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct PeeredVpc {
            /// Required. The name of the peered VPC owned by the consumer project.
            pub network_vpc: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl PeeredVpc {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [network_vpc][crate::model::client_connector_service::egress::PeeredVpc::network_vpc].
            pub fn set_network_vpc<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.network_vpc = v.into();
                self
            }
        }

        impl wkt::message::Message for PeeredVpc {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.Egress.PeeredVpc"
            }
        }

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum DestinationType {
            /// A VPC from the consumer project.
            PeeredVpc(std::boxed::Box<crate::model::client_connector_service::egress::PeeredVpc>),
        }
    }

    /// Represents the different states of a ClientConnectorService.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default value. This value is unused.
        Unspecified,
        /// ClientConnectorService is being created.
        Creating,
        /// ClientConnectorService is being updated.
        Updating,
        /// ClientConnectorService is being deleted.
        Deleting,
        /// ClientConnectorService is running.
        Running,
        /// ClientConnectorService is down and may be restored in the future.
        /// This happens when CCFE sends ProjectState = OFF.
        Down,
        /// ClientConnectorService encountered an error and is in an indeterministic
        /// state.
        Error,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Updating => std::option::Option::Some(2),
                Self::Deleting => std::option::Option::Some(3),
                Self::Running => std::option::Option::Some(4),
                Self::Down => std::option::Option::Some(5),
                Self::Error => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Updating => std::option::Option::Some("UPDATING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Running => std::option::Option::Some("RUNNING"),
                Self::Down => std::option::Option::Some("DOWN"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Updating,
                3 => Self::Deleting,
                4 => Self::Running,
                5 => Self::Down,
                6 => Self::Error,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "UPDATING" => Self::Updating,
                "DELETING" => Self::Deleting,
                "RUNNING" => Self::Running,
                "DOWN" => Self::Down,
                "ERROR" => Self::Error,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Updating => serializer.serialize_i32(2),
                Self::Deleting => serializer.serialize_i32(3),
                Self::Running => serializer.serialize_i32(4),
                Self::Down => serializer.serialize_i32(5),
                Self::Error => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorService.State",
            ))
        }
    }
}

/// Message for requesting list of ClientConnectorServices.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListClientConnectorServicesRequest {
    /// Required. Parent value for ListClientConnectorServicesRequest.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListClientConnectorServicesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListClientConnectorServicesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListClientConnectorServicesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListClientConnectorServicesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListClientConnectorServicesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListClientConnectorServicesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListClientConnectorServicesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ListClientConnectorServicesRequest"
    }
}

/// Message for response to listing ClientConnectorServices.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListClientConnectorServicesResponse {
    /// The list of ClientConnectorService.
    pub client_connector_services: std::vec::Vec<crate::model::ClientConnectorService>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListClientConnectorServicesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [client_connector_services][crate::model::ListClientConnectorServicesResponse::client_connector_services].
    pub fn set_client_connector_services<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ClientConnectorService>,
    {
        use std::iter::Iterator;
        self.client_connector_services = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListClientConnectorServicesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListClientConnectorServicesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListClientConnectorServicesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ListClientConnectorServicesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListClientConnectorServicesResponse {
    type PageItem = crate::model::ClientConnectorService;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.client_connector_services
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a ClientConnectorService.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetClientConnectorServiceRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetClientConnectorServiceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetClientConnectorServiceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetClientConnectorServiceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.GetClientConnectorServiceRequest"
    }
}

/// Message for creating a ClientConnectorService.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateClientConnectorServiceRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Optional. User-settable client connector service resource ID.
    ///
    /// * Must start with a letter.
    /// * Must contain between 4-63 characters from `/[a-z][0-9]-/`.
    /// * Must end with a number or a letter.
    ///
    /// A random system generated name will be assigned
    /// if not specified by the user.
    pub client_connector_service_id: std::string::String,

    /// Required. The resource being created.
    pub client_connector_service: std::option::Option<crate::model::ClientConnectorService>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and t
    /// he request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set, validates request by executing a dry-run which would not
    /// alter the resource in any way.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateClientConnectorServiceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateClientConnectorServiceRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [client_connector_service_id][crate::model::CreateClientConnectorServiceRequest::client_connector_service_id].
    pub fn set_client_connector_service_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.client_connector_service_id = v.into();
        self
    }

    /// Sets the value of [client_connector_service][crate::model::CreateClientConnectorServiceRequest::client_connector_service].
    pub fn set_client_connector_service<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ClientConnectorService>,
    {
        self.client_connector_service = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [client_connector_service][crate::model::CreateClientConnectorServiceRequest::client_connector_service].
    pub fn set_or_clear_client_connector_service<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ClientConnectorService>,
    {
        self.client_connector_service = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateClientConnectorServiceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::CreateClientConnectorServiceRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreateClientConnectorServiceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.CreateClientConnectorServiceRequest"
    }
}

/// Message for updating a ClientConnectorService
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateClientConnectorServiceRequest {
    /// Required. Field mask is used to specify the fields to be overwritten in the
    /// ClientConnectorService resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    ///
    /// Mutable fields: display_name.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated.
    pub client_connector_service: std::option::Option<crate::model::ClientConnectorService>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and t
    /// he request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set, validates request by executing a dry-run which would not
    /// alter the resource in any way.
    pub validate_only: bool,

    /// Optional. If set as true, will create the resource if it is not found.
    pub allow_missing: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateClientConnectorServiceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateClientConnectorServiceRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateClientConnectorServiceRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [client_connector_service][crate::model::UpdateClientConnectorServiceRequest::client_connector_service].
    pub fn set_client_connector_service<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ClientConnectorService>,
    {
        self.client_connector_service = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [client_connector_service][crate::model::UpdateClientConnectorServiceRequest::client_connector_service].
    pub fn set_or_clear_client_connector_service<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ClientConnectorService>,
    {
        self.client_connector_service = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateClientConnectorServiceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::UpdateClientConnectorServiceRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [allow_missing][crate::model::UpdateClientConnectorServiceRequest::allow_missing].
    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.allow_missing = v.into();
        self
    }
}

impl wkt::message::Message for UpdateClientConnectorServiceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.UpdateClientConnectorServiceRequest"
    }
}

/// Message for deleting a ClientConnectorService.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteClientConnectorServiceRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and t
    /// he request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set, validates request by executing a dry-run which would not
    /// alter the resource in any way.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteClientConnectorServiceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteClientConnectorServiceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteClientConnectorServiceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeleteClientConnectorServiceRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for DeleteClientConnectorServiceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.DeleteClientConnectorServiceRequest"
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClientConnectorServiceOperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ClientConnectorServiceOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::ClientConnectorServiceOperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ClientConnectorServiceOperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ClientConnectorServiceOperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ClientConnectorServiceOperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::ClientConnectorServiceOperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::ClientConnectorServiceOperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::ClientConnectorServiceOperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::ClientConnectorServiceOperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::ClientConnectorServiceOperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for ClientConnectorServiceOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorServiceOperationMetadata"
    }
}
